package com.bit.springmybatis.Mapper;

import com.bit.springmybatis.model.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserInfoMapper {
    @Select("select * from user_info")
    List<UserInfo> selectAll();
    @Select("SELECT * FROM user_info WHERE username = #{username}")
    List<UserInfo> selectAll_byName(String username);
   @Insert("INSERT INTO user_info (username,`password`,age)  VALUES(#{name},#{password},#{age})")
    int insert(String password,int age,String name);
    //传递对象
    @Insert("INSERT INTO user_info (username,`password`,age,phone)  VALUES(#{username},#{password},#{age},#{phone})")
    int insert2(UserInfo userInfo);
}
